home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
usenet
/
st80_pre4
/
MacBracketCodes.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
2KB
|
69 lines
" NAME MacBracketCodes
AUTHOR Dag Svanaes <dags@zevs.ifi.unit.no>
FUNCTION char code correction for Mac
ST-VERSION 2.5
PREREQUISITES
CONFLICTS
DISTRIBUTION world
VERSION 1
DATE 9 September 1991
SUMMARY
I am using Eudora on a Mac II.
I had to convert it though because of inconsistency in ASCII codes
for '[', ']', '|' and '\'. Please find enclosed the changes to
ExternalReadStream (version 2.5) to fix it if that is to any use.
"!
!ExternalReadStream methodsFor: 'accessing'!
nextAsItWas
"Answer the next object in the Stream represented by the receiver."
| ch |
position >= readLimit
ifTrue: [ch _ self pastEnd.
ch == nil ifTrue: [^nil]]
ifFalse: [ch _ collection at: (position _ position + 1)].
(binary or: [lineEndConvention == LineEndCR])
ifTrue: [^ch].
lineEndConvention == LineEndLF
ifTrue: [ch == LF
ifTrue: [^CR]
ifFalse: [^ch]].
lineEndConvention == LineEndCRLF
ifTrue: [ch == CR
ifTrue: [position >= readLimit
ifTrue: [ch _ self pastEnd.
ch == nil ifTrue: [^CR]]
ifFalse: [ch _ collection at: (position _ position + 1)].
ch == LF ifFalse: [position _ position - 1].
^CR]
ifFalse: [^ch]].
lineEndConvention == LineEndTransparent
ifTrue: [^ch]! !
!ExternalReadStream methodsFor: 'MacCharCodes'!
next
"Added by Dag Svanaes because SMALLTALK/goodies have wrong
ASCII code for brackets. (As seen from my Mac)"
| ch |
ch _ self nextAsItWas.
"ch _ $x. self halt."
((ch asciiValue) = 191) ifTrue: [ ch _ ('|' at: 1)].
((ch asciiValue) = 174) ifTrue: [ ch _ ('[' at: 1)].
((ch asciiValue) = 129) ifTrue: [ ch _ (']' at: 1)].
((ch asciiValue) = 175) ifTrue: [ ch _ ('\' at: 1)].
^ ch.! !